/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.model;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;

/**
 * @author joewee
 * @version 1.0.0
 * @Date 2017/11/8 12:00
 */
public class CouponModel {
    private Long id, customerId, couponId;
    private String description, name, type, discountType, unavailableReason;
    private boolean available, expiration;
    private List rules;
    private Date startTime, endTime, consumedTime;
    private BigDecimal discount;
    private BigDecimal orderRequirement;
    private String code;
    private Integer quantityAvailable, quantity;
    private String validityType;
    private Integer validityDays;
    private BigInteger bonusPoints;
    private String imgUrl;
    private String price;
    private String payType;

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    public Long getCouponId() {
        return couponId;
    }

    public void setCouponId(Long couponId) {
        this.couponId = couponId;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDiscountType() {
        return discountType;
    }

    public void setDiscountType(String discountType) {
        this.discountType = discountType;
    }

    public String getUnavailableReason() {
        return unavailableReason;
    }

    public void setUnavailableReason(String unavailableReason) {
        this.unavailableReason = unavailableReason;
    }

    public boolean isAvailable() {
        return available;
    }

    public void setAvailable(boolean available) {
        this.available = available;
    }

    public boolean isExpiration() {
        return expiration;
    }

    public void setExpiration(boolean expiration) {
        this.expiration = expiration;
    }

    public List getRules() {
        return rules;
    }

    public void setRules(List rules) {
        this.rules = rules;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Date getConsumedTime() {
        return consumedTime;
    }

    public void setConsumedTime(Date consumedTime) {
        this.consumedTime = consumedTime;
    }

    public BigDecimal getDiscount() {
        return discount;
    }

    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }

    public BigDecimal getOrderRequirement() {
        return orderRequirement;
    }

    public void setOrderRequirement(BigDecimal orderRequirement) {
        this.orderRequirement = orderRequirement;
    }

    public Integer getQuantityAvailable() {
        return quantityAvailable;
    }

    public void setQuantityAvailable(Integer quantityAvailable) {
        this.quantityAvailable = quantityAvailable;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public String getValidityType() {
        return validityType;
    }

    public void setValidityType(String validityType) {
        this.validityType = validityType;
    }

    public Integer getValidityDays() {
        return validityDays;
    }

    public void setValidityDays(Integer validityDays) {
        this.validityDays = validityDays;
    }

    public BigInteger getBonusPoints() {
        return bonusPoints;
    }

    public void setBonusPoints(BigInteger bonusPoints) {
        this.bonusPoints = bonusPoints;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CouponModel model = (CouponModel) o;

        if (!getCustomerId().equals(model.getCustomerId())) return false;
        if (!getCouponId().equals(model.getCouponId())) return false;
        if (getDescription() != null ? !getDescription().equals(model.getDescription()) : model.getDescription() != null)
            return false;
        if (!getName().equals(model.getName())) return false;
        if (!getType().equals(model.getType())) return false;
        if (!getDiscountType().equals(model.getDiscountType())) return false;
        if (!getStartTime().equals(model.getStartTime())) return false;
        if (!getEndTime().equals(model.getEndTime())) return false;
        if (!getDiscount().equals(model.getDiscount())) return false;
        if (getOrderRequirement() != null ? !getOrderRequirement().equals(model.getOrderRequirement()) : model.getOrderRequirement() != null)
            return false;
        if (getValidityType() != null ? !getValidityType().equals(model.getValidityType()) : model.getValidityType() != null)
            return false;
        return getValidityDays() != null ? getValidityDays().equals(model.getValidityDays()) : model.getValidityDays() == null;
    }

    @Override
    public int hashCode() {
        int result = getCustomerId().hashCode();
        result = 31 * result + getCouponId().hashCode();
        result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0);
        result = 31 * result + getName().hashCode();
        result = 31 * result + getType().hashCode();
        result = 31 * result + getDiscountType().hashCode();
        result = 31 * result + getStartTime().hashCode();
        result = 31 * result + getEndTime().hashCode();
        result = 31 * result + getDiscount().hashCode();
        result = 31 * result + (getOrderRequirement() != null ? getOrderRequirement().hashCode() : 0);
        result = 31 * result + (getValidityType() != null ? getValidityType().hashCode() : 0);
        result = 31 * result + (getValidityDays() != null ? getValidityDays().hashCode() : 0);
        return result;
    }
}
